
#include "ams_core.h"
using namespace std;
vector<Task> ts;
void doLoop() {
    while (true) {
        DayTimePoint cur = TimeHelper::getCurrentDayTimePoint();
        for (auto &x : ts) {
            if (x.onTime(cur)) {
                int code = x.exec();
                if (code != 0) {
                    printf("On %d:%d executed %s, failed with code %d\n", cur.h, cur.m, x.getTaskSrc().c_str(), code);
                }
            }
        }
        Sleep(1000 * 1);
    }
}
int main() {
    readTasks(ts);
    doLoop();
}